const path = require('path')

module.exports = {
  lintOnSave: process.env.VUE_APP__ENV !== 'production',
  transpileDependencies: [
    'vue-echarts',
    'resize-detector'
  ],
  productionSourceMap: false, // 关闭生产环境的source map
  chainWebpack: config => {},
  devServer: {
    disableHostCheck: true, // webpack4.0 开启热更新
    proxy: {
      [process.env.VUE_APP_BASE_API]: {
        target: '',
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API
        },
      },
      [process.env.VUE_APP_APPMEDIA]: {
        target: '',
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_APPMEDIA]: process.env.VUE_APP_APPMEDIA
        },
      },
    }
  },
  pluginOptions: {
    // 对于变量的引入，需要在每个文件里都要引入一遍，为了避免每次使用时都需要单独引入一遍的问题
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [
        path.resolve(__dirname, '@/assets/styles/index.less')
      ]
    }
  }
}